home *** CD-ROM | disk | FTP | other *** search
-
- ********************************************************
- This scheduler treats LEVEL1 as the highest level of priority.
- IDLE tests greater than all other levels.
-
- struct actions {
- int priority;
- void (*action)();
- char * arg;
- struct actions *nxtptr;
- } ready [MAX_WAIT], next;
-
- main ()
- {
- ...
- /* initiate interrupt handlers */
- while (TRUE){
- clevel = IDLE;
- do_loop();
- }
- }
-
- void do_loop()
- {
-
- scheduler:
-
- if (clevel == LEVEL2) return;
- else if ((clevel > LEVEL2) && (getnext(LEVEL2) != EMPTY)){
- push (clevel);
- clevel == LEVEL2; /*should be locked */
- (*next.action)(next.arg);
- clevel=pop(); /*lock*/
- goto scheduler;
- }
- else if ((clevel > LEVEL3) && (getnext(LEVEL3) != EMPTY)){
- push (clevel);
- clevel == LEVEL3; /*lock*/
- (*next.action)(next.arg);
- clevel=pop(); /*lock*/
- goto scheduler;
- }
- else return;
- }
-
- *********************LISTING 6*************************
-
-
-
-
-